package com.xiaoyu.base.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.xiaoyu.base.entity.UserKvEntity;

import java.util.List;

import static androidx.room.OnConflictStrategy.REPLACE;

@Dao
public interface UserKvDao {

    String LOG_TAG = "lib-dao";

    @Insert(onConflict = REPLACE)
    void upsert(UserKvEntity entity);

    @Insert(onConflict = REPLACE)
    void upsertList(List<UserKvEntity> entityList);

    @Query("SELECT * From user_kv WHERE `key` = :key")
    UserKvEntity get(String key);

    @Query("SELECT * From user_kv")
    List<UserKvEntity> getList();
}
